import request from '@/utils/request'

export const getAllUser = (params) => {
  return request.get('/sys/user', { params })
}

export const ImpotUser = (data) => {
  return request.post('/sys/user/batch', data)
}

/**
 * 删除员工接口
 * ****/

export function delEmployee(id) {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}

// 增加员工
export function addEmployee(data) {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}

// 获取员工个人信息
export const inquireUser = (id) => {
  return request.get(`/employees/${id}/personalInfo`)
}

// 保存员工个人信息
export const updateUser = (data) => {
  return request.put(`/employees/${data.userId}/personalInfo`, data)
}

// 员工隐私基本信息
export const userDetails = (id) => {
  return request.get(`/sys/user/${id}`)
}

// 保存/更新员工信息
export const SaveuserDetails = (data) => {
  return request.put(`/sys/user/${data.id}`, data)
}

// 员工岗位信息
export const userJobDetails = (id) => {
  return request.get(`/employees/${id}/jobs`)
}

// 保存员工岗位信息
export const saveJobDetails = (data) => {
  return request.put(`/employees/${data.userId}/jobs`, data)
}

